package com.ruoyi.framework.config;

import org.springframework.context.annotation.Configuration;

import java.io.File;
import java.util.Objects;

/**
 * @author: lb
 * @date: 2024/3/27 11:53
 * @desc: shardingSphere分表配置
 **/
@Configuration
public class ShardingConfig {

    /** 配置文件路径 */
    private static final String CONFIG_FILE = "sharding.yaml";

    /**
     * 获取数据源配置
     */
    public static File getShardingYAMLFile() {
        return new File(Objects.requireNonNull(
                ShardingConfig.class.getClassLoader().getResource(CONFIG_FILE), String.format("File `%s` is not existed.", CONFIG_FILE)).getFile());
    }

}
